/**
 *****************************************************************************************************
 * @copyright	(c)  Shenzhen Saiyuan Microelectronics Co., Ltd
 * @file	         SC_Init.c
 * @author
 * @version
 * @date
 * @brief
 * @details         Contains the MCU initialization function and its C file
 *****************************************************************************************************
 * @attention
 *
 *****************************************************************************************************
 */

#include "SC_Init.h" // MCU initialization header file, including all firmware library header files
#include "SCDriver_List.h"
#include "HeadFiles\SC_itExtern.h"

/**************************************Generated by EasyCodeCube*************************************/
// Forbid editing areas between the labels !!!
/*************************************.Generated by EasyCodeCube.************************************/

/**
 * @brief MCU init
 * @note
 * @param
 */
void SC_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    SC_GPIO_Init();
    SC_OPTION_Init();
    SC_RCC_Init();
    SC_SYSTICK_Init();
    // SC_UART1_Init();
    SC_TWI0_Init();
    // SC_TIM0_Init();
    // SC_TIM1_Init();
    // SC_TIM2_Init();
    // SC_TIM3_Init();
    // SC_PWM0_Init();
    // SC_INT_Init();
    // SC_DMA0_Init();
    // SC_DMA1_Init();
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief RCC init
 * @note
 * @param
 */
void SC_RCC_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_Unlock(0xFF);
    RCC_HXTCmd(DISABLE);
    RCC_LXTCmd(DISABLE);
    RCC_LIRCCmd(ENABLE);
    RCC_HIRCCmd(ENABLE);
    /*INTEN*/ RCC_ITConfig(ENABLE);
    RCC_SYSCLKConfig(RCC_SYSCLKSource_HIRC);
    RCC_HCLKConfig(RCC_SYSCLK_Div1);
    RCC_APB0Config(RCC_HCLK_Div1);
    RCC_APB0Cmd(ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief system timer init
 * @note
 * @param
 */
void SC_SYSTICK_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_Unlock(0xFF);
    RCC_SystickCLKConfig(RCC_SysTickSource_HCLK_DIV8);
    RCC_SystickSetCounter(160000);
    NVIC_SetPriority(SysTick_IRQn, 3);
    RCC_SystickCmd(ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief custom OPTION init
 * @note
 * @param
 */
void SC_OPTION_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    SC32F10xSx_NIO_Init();
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief nvic init
 * @note
 * @param
 */
void SC_NVIC_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief GPIO init
 * @note
 * @param
 */
void SC_GPIO_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*GPIOInit_PC10 Struct*/ GPIO_InitTypeDef GPIOInit_PC10_Struct;
    GPIOInit_PC10_Struct.GPIO_Pin = GPIO_Pin_10;
    GPIOInit_PC10_Struct.GPIO_Mode = GPIO_Mode_OUT_PP;
    GPIOInit_PC10_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOC, &GPIOInit_PC10_Struct); /*PC.10�˿ڳ�ʼ��*/
    /*GPIOInit_PA07 Struct*/ GPIO_InitTypeDef GPIOInit_PA07_Struct;
    GPIOInit_PA07_Struct.GPIO_Pin = GPIO_Pin_7;
    GPIOInit_PA07_Struct.GPIO_Mode = GPIO_Mode_OUT_PP;
    GPIOInit_PA07_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA07_Struct); /*PA.07�˿ڳ�ʼ��*/
    /*GPIOInit_PA08 Struct*/ GPIO_InitTypeDef GPIOInit_PA08_Struct;
    GPIOInit_PA08_Struct.GPIO_Pin = GPIO_Pin_8;
    GPIOInit_PA08_Struct.GPIO_Mode = GPIO_Mode_OUT_PP;
    GPIOInit_PA08_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA08_Struct); /*PA.08�˿ڳ�ʼ��*/
    /*GPIOInit_PA15 Struct*/ GPIO_InitTypeDef GPIOInit_PA15_Struct;
    GPIOInit_PA15_Struct.GPIO_Pin = GPIO_Pin_15;
    GPIOInit_PA15_Struct.GPIO_Mode = GPIO_Mode_OUT_PP;
    GPIOInit_PA15_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA15_Struct); /*PA.15�˿ڳ�ʼ��*/                                            /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief UART0 init
 * @note
 * @param
 */
void SC_UART0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief UART1 init
 * @note
 * @param
 */
void SC_UART1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*GPIOInit_PA13 Struct*/ GPIO_InitTypeDef GPIOInit_PA13_Struct;
    GPIOInit_PA13_Struct.GPIO_Pin = GPIO_Pin_13;
    GPIOInit_PA13_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PA13_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA13_Struct); /*RX1�˿ڳ�ʼ��*/
    /*GPIOInit_PA14 Struct*/ GPIO_InitTypeDef GPIOInit_PA14_Struct;
    GPIOInit_PA14_Struct.GPIO_Pin = GPIO_Pin_14;
    GPIOInit_PA14_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PA14_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA14_Struct); /*TX1�˿ڳ�ʼ��*/
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_UART1, ENABLE);
    /*Init Struct*/ UART_InitTypeDef UART_InitStruct;
    UART_InitStruct.UART_ClockFrequency = 32000000;
    UART_InitStruct.UART_BaudRate = 9600;
    UART_InitStruct.UART_Mode = UART_Mode_10B;
    UART_Init(UART1, &UART_InitStruct);
    /*INT_EN*/ UART_ITConfig(UART1, UART_IT_EN, DISABLE);
    /*DMA_TX*/ UART_DMACmd(UART1, UART_DMAReq_TX, ENABLE);
    /*DMA_RX*/ UART_DMACmd(UART1, UART_DMAReq_RX, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(UART1_3_IRQn, 1); /*UART1_3*/
    NVIC_EnableIRQ(UART1_3_IRQn);
    /*Init Struct*/ UART_PinRemapConfig(UART1, UART_PinRemap_Default);
    UART_TXCmd(UART1, ENABLE);
    UART_RXCmd(UART1, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief UART2 init
 * @note
 * @param
 */
void SC_UART2_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief UART3 init
 * @note
 * @param
 */
void SC_UART3_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief UART4 init
 * @note
 * @param
 */
void SC_UART4_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief UART5 init
 * @note
 * @param
 */
void SC_UART5_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer0 init
 * @note
 * @param
 */
void SC_TIM0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_TIM0, ENABLE);
    /*Init Struct*/ TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
    TIM_TimeBaseInitStruct.TIM_WorkMode = TIM_WorkMode_Timer;
    TIM_TimeBaseInitStruct.TIM_Prescaler = TIM_PRESCALER_32;
    TIM_TimeBaseInitStruct.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInitStruct.TIM_Preload = 15536;
    TIM_TimeBaseInitStruct.TIM_EXENX = TIM_EXENX_Disable;
    TIM_TIMBaseInit(TIM0, &TIM_TimeBaseInitStruct);
    /*Init Struct*/ TIM_IC_InitTypeDef TIM_IC_InitStruct;
    TIM_IC_InitStruct.TIM_RICPIN = TIM_RICPin_Disable;
    TIM_IC_InitStruct.TIM_FICPIN = TIM_FICPin_Disable;
    TIM_ICInit(TIM0, &TIM_IC_InitStruct);
    TIM_ICCmd(TIM0, DISABLE);
    /*INTEN*/ TIM_ITConfig(TIM0, TIM_IT_INTEN, ENABLE);
    /*TI*/ TIM_ITConfig(TIM0, TIM_IT_TI, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(TIMER0_IRQn, 2); /*TIMER0*/
    NVIC_EnableIRQ(TIMER0_IRQn);
    TIM_Cmd(TIM0, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer1 init
 * @note
 * @param
 */
void SC_TIM1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_TIM1, ENABLE);
    /*Init Struct*/ TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
    TIM_TimeBaseInitStruct.TIM_WorkMode = TIM_WorkMode_Timer;
    TIM_TimeBaseInitStruct.TIM_Prescaler = TIM_PRESCALER_128;
    TIM_TimeBaseInitStruct.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInitStruct.TIM_Preload = 23870;
    TIM_TimeBaseInitStruct.TIM_EXENX = TIM_EXENX_Disable;
    TIM_TIMBaseInit(TIM1, &TIM_TimeBaseInitStruct);
    /*Init Struct*/ TIM_IC_InitTypeDef TIM_IC_InitStruct;
    TIM_IC_InitStruct.TIM_RICPIN = TIM_RICPin_Disable;
    TIM_IC_InitStruct.TIM_FICPIN = TIM_FICPin_Disable;
    TIM_ICInit(TIM1, &TIM_IC_InitStruct);
    TIM_ICCmd(TIM1, DISABLE);
    /*Init Struct*/ TIM_PWM_InitTypeDef TIM_PWM_InitStruct;
    TIM_PWM_InitStruct.TIM_PWMOutputChannl = TIM_PWMChannel_Less;
    TIM_PWM_InitStruct.TIM_PWMLowPolarityChannl = TIM_PWMChannel_Less;
    TIM_PWMInit(TIM1, &TIM_PWM_InitStruct);
    TIM_PWMSetDuty(TIM1, TIM_PWMChannel_PWMA, 50);
    /*INTEN*/ TIM_ITConfig(TIM1, TIM_IT_INTEN, ENABLE);
    /*TI*/ TIM_ITConfig(TIM1, TIM_IT_TI, ENABLE);
    /*CAPR*/ TIM_DMACmd(TIM1, TIM_DMAReq_CAPR, DISABLE);
    /*CAPF*/ TIM_DMACmd(TIM1, TIM_DMAReq_CAPF, DISABLE);
    TIM_DMACmd(TIM1, TIM_DMAReq_TI, DISABLE);
    /*Init Struct*/ NVIC_SetPriority(TIMER1_IRQn, 0); /*TIMER1*/
    NVIC_EnableIRQ(TIMER1_IRQn);
    TIM_Cmd(TIM1, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer2 init
 * @note
 * @param
 */
void SC_TIM2_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_TIM2, ENABLE);
    /*Init Struct*/ TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
    TIM_TimeBaseInitStruct.TIM_WorkMode = TIM_WorkMode_Timer;
    TIM_TimeBaseInitStruct.TIM_Prescaler = TIM_PRESCALER_32;
    TIM_TimeBaseInitStruct.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInitStruct.TIM_Preload = 1000;
    TIM_TimeBaseInitStruct.TIM_EXENX = TIM_EXENX_Disable;
    TIM_TIMBaseInit(TIM2, &TIM_TimeBaseInitStruct);
    /*Init Struct*/ TIM_IC_InitTypeDef TIM_IC_InitStruct;
    TIM_IC_InitStruct.TIM_RICPIN = TIM_RICPin_Disable;
    TIM_IC_InitStruct.TIM_FICPIN = TIM_FICPin_Disable;
    TIM_ICInit(TIM2, &TIM_IC_InitStruct);
    TIM_ICCmd(TIM2, DISABLE);
    /*Init Struct*/ TIM_PWM_InitTypeDef TIM_PWM_InitStruct;
    TIM_PWM_InitStruct.TIM_PWMOutputChannl = TIM_PWMChannel_PWMA;
    TIM_PWM_InitStruct.TIM_PWMLowPolarityChannl = TIM_PWMChannel_Less;
    TIM_PWMInit(TIM2, &TIM_PWM_InitStruct);
    TIM_PinRemapConfig(TIM2, TIM_PinRemap_Default);
    TIM_PWMSetDuty(TIM2, TIM_PWMChannel_PWMA, 10);
    /*INTEN*/ TIM_ITConfig(TIM2, TIM_IT_INTEN, DISABLE);
    /*CAPR*/ TIM_DMACmd(TIM2, TIM_DMAReq_CAPR, DISABLE);
    /*CAPF*/ TIM_DMACmd(TIM2, TIM_DMAReq_CAPF, DISABLE);
    /*TI*/ TIM_DMACmd(TIM2, TIM_DMAReq_TI, DISABLE);
    /*Init Struct*/ NVIC_SetPriority(TIMER2_IRQn, 1); /*TIMER2*/
    NVIC_EnableIRQ(TIMER2_IRQn);
    TIM_Cmd(TIM2, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer3 init
 * @note
 * @param
 */
void SC_TIM3_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_TIM3, ENABLE);
    /*Init Struct*/ TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
    TIM_TimeBaseInitStruct.TIM_WorkMode = TIM_WorkMode_Timer;
    TIM_TimeBaseInitStruct.TIM_Prescaler = TIM_PRESCALER_4;
    TIM_TimeBaseInitStruct.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInitStruct.TIM_Preload = 2728;
    TIM_TimeBaseInitStruct.TIM_EXENX = TIM_EXENX_Disable;
    TIM_TIMBaseInit(TIM3, &TIM_TimeBaseInitStruct);
    /*Init Struct*/ TIM_IC_InitTypeDef TIM_IC_InitStruct;
    TIM_IC_InitStruct.TIM_RICPIN = TIM_RICPin_Disable;
    TIM_IC_InitStruct.TIM_FICPIN = TIM_FICPin_Disable;
    TIM_ICInit(TIM3, &TIM_IC_InitStruct);
    TIM_ICCmd(TIM3, DISABLE);
    /*Init Struct*/ TIM_PWM_InitTypeDef TIM_PWM_InitStruct;
    TIM_PWM_InitStruct.TIM_PWMOutputChannl = TIM_PWMChannel_Less;
    TIM_PWM_InitStruct.TIM_PWMLowPolarityChannl = TIM_PWMChannel_Less;
    TIM_PWMInit(TIM3, &TIM_PWM_InitStruct);
    TIM_PWMSetDuty(TIM3, TIM_PWMChannel_PWMA, 50);
    /*INTEN*/ TIM_ITConfig(TIM3, TIM_IT_INTEN, ENABLE);
    /*TI*/ TIM_ITConfig(TIM3, TIM_IT_TI, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(TIMER3_IRQn, 1); /*TIMER3*/
    NVIC_EnableIRQ(TIMER3_IRQn);
    TIM_Cmd(TIM3, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer4 init
 * @note
 * @param
 */
void SC_TIM4_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer5 init
 * @note
 * @param
 */
void SC_TIM5_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer6 init
 * @note
 * @param
 */
void SC_TIM6_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief Timer7 init
 * @note
 * @param
 */
void SC_TIM7_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief PWM0 init
 * @note
 * @param
 */
void SC_PWM0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_Unlock(0xFF);
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_PWM0, ENABLE);
    /*PWM00*/ PWM_SetDuty(PWM0, PWM_Channel_0, 0);
    /*PWM01*/ PWM_SetDuty(PWM0, PWM_Channel_1, 0);
    /*PWM02*/ PWM_SetDuty(PWM0, PWM_Channel_2, 0);
    /*PWM03*/ PWM_SetDuty(PWM0, PWM_Channel_3, 0);
    /*PWM04*/ PWM_SetDuty(PWM0, PWM_Channel_4, 0);
    /*PWM05*/ PWM_SetDuty(PWM0, PWM_Channel_5, 0);
    /*PWM06*/ PWM_SetDuty(PWM0, PWM_Channel_6, 0);
    /*PWM07*/ PWM_SetDuty(PWM0, PWM_Channel_7, 0);
    /*Init Struct*/ PWM_InitTypeDef PWM_InitStruct;
    PWM_InitStruct.PWM_WorkMode = PWM_WorkMode_Independent;
    PWM_InitStruct.PWM_Prescaler = PWM_PRESCALER_DIV1;
    PWM_InitStruct.PWM_Cycle = 10000;
    PWM_InitStruct.PWM_OutputChannel = PWMChannel_Less | PWM_Channel_1 | PWM_Channel_2 | PWM_Channel_3;
    PWM_InitStruct.PWM_LowPolarityChannl = PWMChannel_Less;
    PWM_InitStruct.PWM_AlignedMode = PWM_AlignmentMode_Edge;
    PWM_Init(PWM0, &PWM_InitStruct);
    /*Init Struct*/ PWM_FDInitTypeDef PWM_FDInitStruct;
    PWM_FDInitStruct.PWM_FDMode = PWM_FDMode_Immediate;
    PWM_FDInitStruct.PWM_FDVoltage = PWM_FDVoltage_High;
    PWM_FDInitStruct.PWM_FDFilteringTime = PWM_FilteringTime_0us;
    PWM_FDInit(PWM0, &PWM_FDInitStruct);
    PWM_FDCmd(PWM0, DISABLE);
    /*INTEN*/ PWM_ITConfig(PWM0, PWM_IT_INTEN, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(PWM0_IRQn, 2); /*PWM0*/
    NVIC_EnableIRQ(PWM0_IRQn);
    PWM_Cmd(PWM0, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief LEDPWM init
 * @note
 * @param
 */
void SC_LEDPWM_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief INT init
 * @note
 * @param
 */
void SC_INT_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*GPIOInit_PB01 Struct*/ GPIO_InitTypeDef GPIOInit_PB01_Struct;
    GPIOInit_PB01_Struct.GPIO_Pin = GPIO_Pin_1;
    GPIOInit_PB01_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB01_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB01_Struct); /*INT1�˿ڳ�ʼ��*/
    /*GPIOInit_PB02 Struct*/ GPIO_InitTypeDef GPIOInit_PB02_Struct;
    GPIOInit_PB02_Struct.GPIO_Pin = GPIO_Pin_2;
    GPIOInit_PB02_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB02_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB02_Struct); /*INT2�˿ڳ�ʼ��*/
    /*GPIOInit_PB03 Struct*/ GPIO_InitTypeDef GPIOInit_PB03_Struct;
    GPIOInit_PB03_Struct.GPIO_Pin = GPIO_Pin_3;
    GPIOInit_PB03_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB03_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB03_Struct); /*INT3�˿ڳ�ʼ��*/
    /*GPIOInit_PB04 Struct*/ GPIO_InitTypeDef GPIOInit_PB04_Struct;
    GPIOInit_PB04_Struct.GPIO_Pin = GPIO_Pin_4;
    GPIOInit_PB04_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB04_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB04_Struct); /*INT4�˿ڳ�ʼ��*/
    /*GPIOInit_PB05 Struct*/ GPIO_InitTypeDef GPIOInit_PB05_Struct;
    GPIOInit_PB05_Struct.GPIO_Pin = GPIO_Pin_5;
    GPIOInit_PB05_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB05_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB05_Struct); /*INT5�˿ڳ�ʼ��*/
    /*GPIOInit_PB06 Struct*/ GPIO_InitTypeDef GPIOInit_PB06_Struct;
    GPIOInit_PB06_Struct.GPIO_Pin = GPIO_Pin_6;
    GPIOInit_PB06_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB06_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB06_Struct); /*INT6�˿ڳ�ʼ��*/
    /*GPIOInit_PB07 Struct*/ GPIO_InitTypeDef GPIOInit_PB07_Struct;
    GPIOInit_PB07_Struct.GPIO_Pin = GPIO_Pin_7;
    GPIOInit_PB07_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PB07_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOB, &GPIOInit_PB07_Struct); /*INT7�˿ڳ�ʼ��*/
    /*Init Struct*/ INT_InitTypeDef INT1_InitStruct;
    INT1_InitStruct.INT_Channel = INT_Channel_1;
    INT1_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT1_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT1_InitStruct);
    /*INT1*/ INT_ITConfig(INT1_InitStruct.INT_Channel, INT1_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ INT_InitTypeDef INT2_InitStruct;
    INT2_InitStruct.INT_Channel = INT_Channel_2;
    INT2_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT2_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT2_InitStruct);
    /*INT2*/ INT_ITConfig(INT2_InitStruct.INT_Channel, INT2_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ INT_InitTypeDef INT3_InitStruct;
    INT3_InitStruct.INT_Channel = INT_Channel_3;
    INT3_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT3_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT3_InitStruct);
    /*INT3*/ INT_ITConfig(INT3_InitStruct.INT_Channel, INT3_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ INT_InitTypeDef INT4_InitStruct;
    INT4_InitStruct.INT_Channel = INT_Channel_4;
    INT4_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT4_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT4_InitStruct);
    /*INT4*/ INT_ITConfig(INT4_InitStruct.INT_Channel, INT4_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ INT_InitTypeDef INT5_InitStruct;
    INT5_InitStruct.INT_Channel = INT_Channel_5;
    INT5_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT5_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT5_InitStruct);
    /*INT5*/ INT_ITConfig(INT5_InitStruct.INT_Channel, INT5_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ INT_InitTypeDef INT6_InitStruct;
    INT6_InitStruct.INT_Channel = INT_Channel_6;
    INT6_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT6_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT6_InitStruct);
    /*INT6*/ INT_ITConfig(INT6_InitStruct.INT_Channel, INT6_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ INT_InitTypeDef INT7_InitStruct;
    INT7_InitStruct.INT_Channel = INT_Channel_7;
    INT7_InitStruct.INT_INTSEL = INT_INTSEL_PB;
    INT7_InitStruct.INT_Trigger = INT_Trigger_Falling;
    INT_Init(&INT7_InitStruct);
    /*INT7*/ INT_ITConfig(INT7_InitStruct.INT_Channel, INT7_InitStruct.INT_Trigger, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(INT1_7_IRQn, 1); /*INT1_7*/
    NVIC_EnableIRQ(INT1_7_IRQn);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief ADC init
 * @note
 * @param
 */
void SC_ADC_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief VREF init
 * @note
 * @param
 */
void SC_VREF_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief DAC init
 * @note
 * @param
 */
void SC_DAC_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief TemperSensor init
 * @note
 * @param
 */
void SC_TemperSensor_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief PCAP init
 * @note
 * @param
 */
void SC_PCAP_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief EPWM init
 * @note
 * @param
 */
void SC_EPWM_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief OP init
 * @note
 * @param
 */
void SC_OP_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief OP0 init
 * @note
 * @param
 */
void SC_OP0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}
/**
 * @brief OP1 init
 * @note
 * @param
 */
void SC_OP1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief OP2 init
 * @note
 * @param
 */
void SC_OP2_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief QEP0 init
 * @note
 * @param
 */
void SC_QEP0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief QEP1 init
 * @note
 * @param
 */
void SC_QEP1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief CAN init
 * @note
 * @param
 */
void SC_CAN_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief IAP init
 * @note
 * @param
 */
void SC_IAP_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SPI0 init
 * @note
 * @param
 */
void SC_SPI0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SPI1 init
 * @note
 * @param
 */
void SC_SPI1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SPI2 init
 * @note
 * @param
 */
void SC_SPI2_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief TWI0 init
 * @note
 * @param
 */
void SC_TWI0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*GPIOInit_PA05 Struct*/ GPIO_InitTypeDef GPIOInit_PA05_Struct;
    GPIOInit_PA05_Struct.GPIO_Pin = GPIO_Pin_5;
    GPIOInit_PA05_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PA05_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA05_Struct); /*SDA0B�˿ڳ�ʼ��*/
    /*GPIOInit_PA06 Struct*/ GPIO_InitTypeDef GPIOInit_PA06_Struct;
    GPIOInit_PA06_Struct.GPIO_Pin = GPIO_Pin_6;
    GPIOInit_PA06_Struct.GPIO_Mode = GPIO_Mode_IN_PU;
    GPIOInit_PA06_Struct.GPIO_DriveLevel = 0;
    GPIO_Init(GPIOA, &GPIOInit_PA06_Struct); /*SCL0B�˿ڳ�ʼ��*/
    RCC_APB0PeriphClockCmd(RCC_APB0Periph_TWI0, ENABLE);
    /*Init Struct*/ TWI_InitTypeDef TWI_InitStruct;
    TWI_InitStruct.TWI_Ack = TWI_Ack_Enable;
    TWI_InitStruct.TWI_Prescaler = TWI_PRESCALER_32;
    TWI_InitStruct.TWI_Stretch = TWI_Stretch_Disable;
    TWI_InitStruct.TWI_SlaveAdress = 0x78;
    TWI_InitStruct.TWI_GeneralCall = TWI_GeneralCall_Disable;
    TWI_Init(TWI0, &TWI_InitStruct);
    TWI_PinRemapConfig(TWI0, TWI_PinRemap_B);
    /*INT*/ TWI_ITConfig(TWI0, TWI_IT_INT, ENABLE);
    /*DMA_TX*/ TWI_DMACmd(TWI0, TWI_DMAReq_TX, DISABLE);
    /*DMA_RX*/ TWI_DMACmd(TWI0, TWI_DMAReq_RX, DISABLE);
    /*Init Struct*/ NVIC_SetPriority(TWI0_IRQn, 2); /*TWI0*/
    NVIC_EnableIRQ(TWI0_IRQn);
    TWI_Cmd(TWI0, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief TWI1 init
 * @note
 * @param
 */
void SC_TWI1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief BTM init
 * @note
 * @param
 */
void SC_BTM_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief CRC init
 * @note
 * @param
 */
void SC_CRC_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief DMA0 init
 * @note
 * @param
 */
void SC_DMA0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA, ENABLE);
    /*Init Struct*/ DMA_InitTypeDef DMA_InitStruct;
    DMA_InitStruct.DMA_Priority = DMA_Priority_HIGH;
    DMA_InitStruct.DMA_TargetMode = DMA_TargetMode_FIXED;
    DMA_InitStruct.DMA_SourceMode = DMA_SourceMode_INC_CIRC;
    DMA_InitStruct.DMA_SrcAddress = (uint32_t)TxData;
    DMA_InitStruct.DMA_DstAddress = (uint32_t)&UART1->UART_DATA;
    DMA_InitStruct.DMA_DataSize = DMA_DataSize_Byte;
    DMA_InitStruct.DMA_Burst = DMA_Burst_Disable;
    DMA_InitStruct.DMA_Request = DMA_Request_UART1_TX;
    DMA_InitStruct.DMA_BufferSize = 0x0b;
    DMA_InitStruct.DMA_CircularMode = DMA_CircularMode_Disable;
    DMA_Init(DMA0, &DMA_InitStruct);
    /*INTEN*/ DMA_ITConfig(DMA0, DMA_IT_INTEN, ENABLE);
    /*TEIE*/ DMA_ITConfig(DMA0, DMA_IT_TEIE, DISABLE);
    /*HTIE*/ DMA_ITConfig(DMA0, DMA_IT_HTIE, DISABLE);
    /*TCIE*/ DMA_ITConfig(DMA0, DMA_IT_TCIE, ENABLE);
    DMA_DMACmd(DMA0, DMA_DMAReq_CHRQ, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(DMA0_IRQn, 1); /*DMA0*/
    NVIC_EnableIRQ(DMA0_IRQn);
    DMA_Cmd(DMA0, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief DMA1 init
 * @note
 * @param
 */
void SC_DMA1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA, ENABLE);
    /*Init Struct*/ DMA_InitTypeDef DMA_InitStruct;
    DMA_InitStruct.DMA_Priority = DMA_Priority_VERY_HIGH;
    DMA_InitStruct.DMA_TargetMode = DMA_TargetMode_INC_CIRC;
    DMA_InitStruct.DMA_SourceMode = DMA_SourceMode_FIXED;
    DMA_InitStruct.DMA_SrcAddress = (uint32_t)&UART1->UART_DATA;
    DMA_InitStruct.DMA_DstAddress = (uint32_t)RxData;
    DMA_InitStruct.DMA_DataSize = DMA_DataSize_Byte;
    DMA_InitStruct.DMA_Burst = DMA_Burst_Disable;
    DMA_InitStruct.DMA_Request = DMA_Request_UART1_RX;
    DMA_InitStruct.DMA_BufferSize = 0x0b;
    DMA_InitStruct.DMA_CircularMode = DMA_CircularMode_Enable;
    DMA_Init(DMA1, &DMA_InitStruct);
    /*INTEN*/ DMA_ITConfig(DMA1, DMA_IT_INTEN, ENABLE);
    /*TEIE*/ DMA_ITConfig(DMA1, DMA_IT_TEIE, DISABLE);
    /*HTIE*/ DMA_ITConfig(DMA1, DMA_IT_HTIE, DISABLE);
    /*TCIE*/ DMA_ITConfig(DMA1, DMA_IT_TCIE, ENABLE);
    DMA_DMACmd(DMA1, DMA_DMAReq_CHRQ, ENABLE);
    /*Init Struct*/ NVIC_SetPriority(DMA1_IRQn, 1); /*DMA1*/
    NVIC_EnableIRQ(DMA1_IRQn);
    DMA_Cmd(DMA1, ENABLE);
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief DMA2 init
 * @note
 * @param
 */
void SC_DMA2_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief DMA3 init
 * @note
 * @param
 */
void SC_DMA3_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief WDT init
 * @note
 * @param
 */
void SC_WDT_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief PWR init
 * @note
 * @param
 */
void SC_PWR_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief LCD init
 * @note
 * @param
 */

void SC_LCD_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC LED Init
 * @note
 * @param
 */
void SC_LED_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC MR Init
 * @note
 * @param
 */
void SC_MR_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC ACMP Init
 * @note
 * @param
 */
void SC_ACMP_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC ACMP0 Init
 * @note
 * @param
 */
void SC_ACMP0_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC ACMP1 Init
 * @note
 * @param
 */
void SC_ACMP1_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC ACMP2 Init
 * @note
 * @param
 */
void SC_ACMP2_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}

/**
 * @brief SC ACMP3 Init
 * @note
 * @param
 */
void SC_ACMP3_Init(void)
{
    /*<Generated by EasyCodeCube begin>*/
    // Forbid editing areas between the labels !!!
    /*<Generated by EasyCodeCube end>*/
}
